package com.competition.jingdong;
//sku
// ,SKU编码,长,宽,高,SKU是否可以变形
public class Sku implements Comparable{
    int skuNo;
    int length;
    int weight;
    int high;
    long volume;
    boolean change;
    Sku(int skuNo,int length,int weight,int high,boolean change)
    {
        this.skuNo=skuNo;
        this.length=length;
        if(weight>=high)
        {
            this.weight=weight;
            this.high=high;
        }
        else
        {
            this.weight=high;
            this.high=weight;
        }
        this.change=change;
        this.volume = (long) length *weight*high;
    }

    public void reVolume()
    {
        volume = (long) length *weight*high;
    }
    @Override
    public String toString() {
        return "Sku{" +
                "skuNo=" + skuNo +
                ", length=" + length +
                ", weight=" + weight +
                ", high=" + high +
                ", change=" + change +
                '}';
    }

    @Override
    public int compareTo(Object o) {
        if(((Sku)o).volume>this.volume)
            return -1;
        else
            return 1;
    }
    Sku getNLengthSku(int n)
    {
        return new Sku(this.skuNo,this.length*n,this.weight,this.high,this.change);
    }
    Sku getNWeightSku(int n)
    {
        return new Sku(this.skuNo,this.length,this.weight*n,this.high,this.change);
    }
    Sku getNHighSku(int n)
    {
        return new Sku(this.skuNo,this.length,this.weight,this.high*n,this.change);
    }
}
